/*      */ package com.waveset.adapter;
/*      */ 
/*      */ import com.sun.idm.logging.trace.Trace;
/*      */ import com.sun.idm.logging.trace.TraceManager;
/*      */ import com.waveset.adapter.iapi.IAPI;
/*      */ import com.waveset.adapter.iapi.IAPIException;
/*      */ import com.waveset.adapter.iapi.IAPIFactory;
/*      */ import com.waveset.adapter.script.ActionScript;
/*      */ import com.waveset.adapter.script.CloseListener;
/*      */ import com.waveset.adapter.script.ScriptExecutor;
/*      */ import com.waveset.adapter.script.ScriptExecutorFactory;
/*      */ import com.waveset.adapter.script.ScriptedAccountIteratorFactory;
/*      */ import com.waveset.adapter.script.ScriptedAdapter;
/*      */ import com.waveset.exception.ItemNotFound;
/*      */ import com.waveset.msgcat.ErrorMessage;
/*      */ import com.waveset.msgcat.Message;
/*      */ import com.waveset.msgcat.Severity;
/*      */ import com.waveset.object.AccountAttributeType;
/*      */ import com.waveset.object.AttributeValues;
/*      */ import com.waveset.object.GenericObject;
/*      */ import com.waveset.object.Resource;
/*      */ import com.waveset.object.ResourceAction;
/*      */ import com.waveset.object.ResourceInfo;
/*      */ import com.waveset.object.Syntax;
/*      */ import com.waveset.object.WSAttribute;
/*      */ import com.waveset.object.WSAttributes;
/*      */ import com.waveset.object.WSUser;
/*      */ import com.waveset.object.WavesetResult;
/*      */ import com.waveset.util.EncryptedData;
/*      */ import com.waveset.util.InvalidArgument;
/*      */ import com.waveset.util.PooledConnection;
/*      */ import com.waveset.util.Util;
/*      */ import com.waveset.util.WavesetException;
/*      */ import java.io.PrintStream;
/*      */ import java.sql.Connection;
/*      */ import java.sql.SQLException;
/*      */ import java.util.ArrayList;
/*      */ import java.util.HashMap;
/*      */ import java.util.Iterator;
/*      */ import java.util.List;
/*      */ import java.util.Map;
/*      */ 
/*      */ public final class ScriptedJdbcResourceAdapter extends JdbcResourceAdapter
/*      */   implements ActiveSync, ScriptedAdapter
/*      */ {
/*      */   public static final String code_id = "$Id: ScriptedJdbcResourceAdapter.java,v 1.25 2008/11/05 21:55:09 kd229373 Exp $";
/*      */   public static final String CLASS = "com.waveset.adapter.ScriptedJdbcResourceAdapter";
/*   83 */   private static final Trace TRACE = TraceManager.getTrace("com.waveset.adapter.ScriptedJdbcResourceAdapter");
/*      */   public static final String DEFAULT_PORT = "1521";
/*      */   public static final String DEFAULT_DRIVER = "oracle.jdbc.driver.OracleDriver";
/*      */   public static final String DEFAULT_TEMPLATE = "jdbc:oracle:thin:@%h:%p:%d";
/*      */   public static final String RA_ATTR_MAP_MODE = "AttrMapMode";
/*      */   public static final String DIRECT_MAP_MODE = "Direct";
/*      */   public static final String STRING_MAP_MODE = "Strings";
/*      */   private static final String PROP_PROCESSED = "lastProcessed";
/*      */   public static final String RA_GET_USER_ACTIONS = "GetUser Actions";
/*      */   public static final String RA_CREATE_USER_ACTIONS = "CreateUser Actions";
/*      */   public static final String RA_UPDATE_USER_ACTIONS = "UpdateUser Actions";
/*      */   public static final String RA_DELETE_USER_ACTIONS = "DeleteUser Actions";
/*      */   public static final String RA_DISABLE_USER_ACTIONS = "DisableUser Actions";
/*      */   public static final String RA_ENABLE_USER_ACTIONS = "EnableUser Actions";
/*      */   public static final String RA_AUTHENTICATION_ACTIONS = "AuthUser Actions";
/*      */   public static final String RA_LISTALL_ACTIONS = "ListAll Actions";
/*      */   public static final String RA_ACCT_ITER_ACTIONS = "AccountIterator Actions";
/*      */   public static final String RA_ACTIVE_SYNC_ITER_ACTIONS = "ActiveSync Iterator Actions";
/*      */   public static final String RA_TEST_ACTIONS = "Test Actions";
/*      */   private static final String OP_GET_USER = "getUser";
/*      */   private static final String OP_CREATE_USER = "createUser";
/*      */   private static final String OP_UPDATE_USER = "updateUser";
/*      */   private static final String OP_DELETE_USER = "deleteUser";
/*      */   private static final String OP_DISABLE_USER = "disableUser";
/*      */   private static final String OP_ENABLE_USER = "enableUser";
/*      */   private static final String OP_AUTH_USER = "authenticateUser";
/*      */   private static final String OP_LIST_ALL_OBJECTS = "listAllObjects";
/*      */   private static final String OP_ACCT_ITER = "getAccountIterator";
/*      */   private static final String OP_ACTIVE_SYNC_ITER = "getActiveSyncIterator";
/*      */   private static final String OP_TEST = "test";
/*      */   public static final String RESOURCE_NAME = "Scripted JDBC";
/*      */   public static final String RESOURCE_USER_FORM = "Scripted JDBC User Form";
/*      */   ActiveSyncUtil _util;
/*      */   private ResourceAdapterProxy _proxy;
/*  204 */   static final String prototypeXml = "<Resource name='Scripted JDBC' class='com.waveset.adapter.ScriptedJdbcResourceAdapter' typeString='ScriptedJDBC' typeDisplayString='com.waveset.adapter.RAMessages:RESTYPE_SCRIPTED_JDBC' syncSource='true'  facets='provision' >\n  <ResourceAttributes>\n    <ResourceAttribute name='Host' displayName='RESATTR_HOST'\n      description='RESATTR_HELP_DBTABLE_HOST'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Port' displayName='RESATTR_PORT' value='1521'\n      description='RESATTR_HELP_DBTABLE_PORT'>\n    </ResourceAttribute>\n    <ResourceAttribute name='User' displayName='RESATTR_USER'\n      description='RESATTR_HELP_DBTABLE_USER'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Password' displayName='RESATTR_PASSWORD' type='encrypted'\n      description='RESATTR_HELP_DBTABLE_PASSWORD'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Database' displayName='RESATTR_DATABASE'\n       description='RESATTR_HELP_DBTABLE_DATABASE'\n>    </ResourceAttribute>\n    <ResourceAttribute name='JDBC Driver' displayName='RESATTR_JDBC_DRIVER'\n      description='RESATTR_HELP_DBTABLE_DRIVER'      value='oracle.jdbc.driver.OracleDriver'>\n    </ResourceAttribute>\n    <ResourceAttribute name='JDBC URL Template' displayName='RESATTR_URL_TEMPLATE'\n      description='RESATTR_HELP_DBTABLE_URL_TEMPLATE'\n      value='jdbc:oracle:thin:@%h:%p:%d'>\n    </ResourceAttribute>\n    <ResourceAttribute name='idleTimeout' displayName='com.waveset.adapter.RAMessages:RESATTR_DBPOOL_IDLETIMEOUT' type='string' multi='false'\n       description='com.waveset.adapter.RAMessages:RESATTR_DBPOOL_IDLETIMEOUT_HELP'\n       value='600'>\n    </ResourceAttribute>\n    <ResourceAttribute name='rethrowAllSQLExceptions' displayName='com.waveset.adapter.RAMessages:RESATTR_RETHROW_ALL_SQLEXCEPTIONS' type='" + Syntax.BOOLEAN.getName() + "'\n" + "        description='" + "com.waveset.adapter.RAMessages:RESATTR_HELP_RETHROW_ALL_SQLEXCEPTIONS" + "' value='false'>\n" + "    </ResourceAttribute>\n" + "    <ResourceAttribute name='" + "AttrMapMode" + "' displayName='RAMessages:SH_RESATTR_ATTR_MAP' type='string' multi='false' required='true'\n" + "      description='RAMessages:SH_RESATTR_ATTR_MAP_HELP' value='" + "Strings" + "' >\n" + "    </ResourceAttribute>\n" + "    <ResourceAttribute name='" + "GetUser Actions" + "' displayName='RAMessages:SCR_RESATTR_GETUSER_ACTION' type='string' multi='true' required='true' \n" + "      description='RAMessages:SCR_RESATTR_GETUSER_ACTION_HELP'\n >\n" + "    </ResourceAttribute>\n" + "    <ResourceAttribute name='" + "CreateUser Actions" + "' displayName='RAMessages:SCR_RESATTR_CREATEUSER_ACTION' type='string' multi='true'\n" + "      description='RAMessages:SCR_RESATTR_CREATEUSER_ACTION_HELP'\n >\n" + "    </ResourceAttribute>\n" + "    <ResourceAttribute name='" + "UpdateUser Actions" + "' displayName='RAMessages:SCR_RESATTR_UPDATEUSER_ACTION' type='string' multi='true'\n" + "      description='RAMessages:SCR_RESATTR_UPDATEUSER_ACTION_HELP'\n >\n" + "    </ResourceAttribute>\n" + "    <ResourceAttribute name='" + "DeleteUser Actions" + "' displayName='RAMessages:SCR_RESATTR_DELETEUSER_ACTION' type='string' multi='true'\n" + "      description='RAMessages:SCR_RESATTR_DELETEUSER_ACTION_HELP'\n >\n" + "    </ResourceAttribute>\n" + "    <ResourceAttribute name='" + "DisableUser Actions" + "' displayName='RAMessages:SCR_RESATTR_DISABLEUSER_ACTION' type='string' multi='true'\n" + "      description='RAMessages:SCR_RESATTR_DISABLEUSER_ACTION_HELP'\n >\n" + "    </ResourceAttribute>\n" + "    <ResourceAttribute name='" + "EnableUser Actions" + "' displayName='RAMessages:SCR_RESATTR_ENABLEUSER_ACTION' type='string' multi='true'\n" + "      description='RAMessages:SCR_RESATTR_ENABLEUSER_ACTION_HELP'\n >\n" + "    </ResourceAttribute>\n" + "    <ResourceAttribute name='" + "AuthUser Actions" + "' displayName='RAMessages:SCR_RESATTR_AUTH_ACTION' type='string' multi='true'\n" + "      description='RAMessages:SCR_RESATTR_AUTH_ACTION_HELP'\n >\n" + "    </ResourceAttribute>\n" + "    <ResourceAttribute name='" + "ListAll Actions" + "' displayName='RAMessages:SCR_RESATTR_LISTALL_ACTION' type='string' multi='true'\n" + "      description='RAMessages:SCR_RESATTR_LISTALL_ACTION_HELP'\n >\n" + "    </ResourceAttribute>\n" + "    <ResourceAttribute name='" + "AccountIterator Actions" + "' displayName='RAMessages:SCR_RESATTR_USERITER_ACTION' type='string' multi='true'\n" + "      description='RAMessages:SCR_RESATTR_USERITER_ACTION_HELP' \n >\n" + "    </ResourceAttribute>\n" + "    <ResourceAttribute name='" + "ActiveSync Iterator Actions" + "' displayName='RAMessages:SCR_RESATTR_ACTIVESYNC_ITER_ACTION' type='string' multi='true'\n" + "      description='RAMessages:SCR_RESATTR_ACTIVESYNC_ITER_ACTION_HELP' facets='activesync' \n >\n" + "    </ResourceAttribute>\n" + "    <ResourceAttribute name='" + "Test Actions" + "' displayName='RAMessages:SCR_RESATTR_TEST_ACTION' type='string' multi='true'\n" + "      description='RAMessages:SCR_RESATTR_TEST_ACTION_HELP'\n >\n" + "    </ResourceAttribute>\n" + "    <ResourceAttribute name='processRule' displayName='com.waveset.adapter.RAMessages:RESATTR_PROCESS_RULE' type='string' multi='false' \n      description='com.waveset.adapter.RAMessages:RESATTR_PROCESS_RULE_HELP' facets='activesync'>\n    </ResourceAttribute>\n    <ResourceAttribute name='correlationRule' displayName='com.waveset.adapter.RAMessages:RESATTR_CORRELATION_RULE' type='string' multi='false' \n      description='com.waveset.adapter.RAMessages:RESATTR_CORRELATION_RULE_HELP' facets='activesync' value='CORRELATION_RULE_NONE'>\n    </ResourceAttribute>\n    <ResourceAttribute name='confirmationRule' displayName='com.waveset.adapter.RAMessages:RESATTR_CONFIRMATION_RULE' type='string' multi='false' \n      description='com.waveset.adapter.RAMessages:RESATTR_CONFIRMATION_RULE_HELP' facets='activesync' value='CONFIRMATION_RULE_NONE'>\n    </ResourceAttribute>\n    <ResourceAttribute name='deleteRule' displayName='com.waveset.adapter.RAMessages:RESATTR_DELETE_RULE' type='string' multi='false' \n      description='com.waveset.adapter.RAMessages:RESATTR_DELETE_RULE_HELP' facets='activesync'>\n    </ResourceAttribute>\n    <ResourceAttribute name='createUnmatched' displayName='com.waveset.adapter.RAMessages:RESATTR_CREATE_UNMATCHED' type='string' multi='false' value='true'\n      description='com.waveset.adapter.RAMessages:RESATTR_CREATE_UNMATCHED_HELP' facets='activesync'>\n    </ResourceAttribute>\n    <ResourceAttribute name='resolveProcessRule' displayName='com.waveset.adapter.RAMessages:RESATTR_RESOLVE_PROCESS_RULE' type='string' multi='false' \n      description='com.waveset.adapter.RAMessages:RESATTR_RESOLVE_PROCESS_RULE_HELP' facets='activesync'>\n    </ResourceAttribute>\n    <ResourceAttribute name='populateGlobal' displayName='com.waveset.adapter.RAMessages:RESATTR_POPULATE_GLOBAL' type='string' multi='false' value='false'\n      description='com.waveset.adapter.RAMessages:RESATTR_POPULATE_GLOBAL_HELP' facets='activesync'>\n    </ResourceAttribute>\n" + "    <ResourceAttribute name='Proxy Administrator' displayName='com.waveset.adapter.RAMessages:RESATTR_PROXY_ADMINISTRATOR' type='string' multi='false' value='Configurator'\n      description='com.waveset.adapter.RAMessages:RESATTR_HELP_30'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Input Form' displayName='com.waveset.adapter.RAMessages:RESATTR_FORM' type='string' multi='false'\n      description='com.waveset.adapter.RAMessages:RESATTR_HELP_26'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Pre-Poll Workflow' displayName='com.waveset.adapter.RAMessages:RESATTR_PREPOLL_WORKFLOW' type='string' multi='false'\n      description='com.waveset.adapter.RAMessages:RESATTR_PREPOLL_WORKFLOW_HELP'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Post-Poll Workflow' displayName='com.waveset.adapter.RAMessages:RESATTR_POSTPOLL_WORKFLOW' type='string' multi='false'\n      description='com.waveset.adapter.RAMessages:RESATTR_POSTPOLL_WORKFLOW_HELP'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Maximum Archives' displayName='com.waveset.adapter.RAMessages:RESATTR_MAX_ARCHIVES' type='string' multi='false'  value='3'\n      description='com.waveset.adapter.RAMessages:RESATTR_HELP_MAX_ARCHIVES'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Maximum Age Length' displayName='com.waveset.adapter.RAMessages:RESATTR_MAX_LOG_AGE' type='string' multi='false'\n      description='com.waveset.adapter.RAMessages:RESATTR_HELP_MAX_LOG_AGE'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Maximum Age Unit' displayName='com.waveset.adapter.RAMessages:RESATTR_MAX_LOG_AGE_UNIT' type='string' multi='false'\n      description='com.waveset.adapter.RAMessages:RESATTR_HELP_MAX_LOG_AGE_UNIT'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Log Level' displayName='com.waveset.adapter.RAMessages:RESATTR_LOG_LEVEL' type='string' multi='false' value='2'\n      description='com.waveset.adapter.RAMessages:RESATTR_HELP_27'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Log File Path' displayName='com.waveset.adapter.RAMessages:RESATTR_LOG_PATH' type='string' multi='false' \n      description='com.waveset.adapter.RAMessages:RESATTR_HELP_28'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Maximum Log File Size' displayName='com.waveset.adapter.RAMessages:RESATTR_LOG_SIZE' type='string' multi='false' \n      description='com.waveset.adapter.RAMessages:RESATTR_HELP_29'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Scheduling Interval' displayName='com.waveset.adapter.RAMessages:RESATTR_SCHEDULE_INTERVAL' type='string' multi='false' \n      description='com.waveset.adapter.RAMessages:RESATTR_HELP_51'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Poll Every' displayName='com.waveset.adapter.RAMessages:RESATTR_SCHEDULE_INTERVAL_COUNT' type='string' multi='false' \n      description='com.waveset.adapter.RAMessages:RESATTR_HELP_52'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Polling Start Time' displayName='com.waveset.adapter.RAMessages:RESATTR_SCHEDULE_START_TIME' type='string' multi='false' \n      description='com.waveset.adapter.RAMessages:RESATTR_HELP_56'>\n    </ResourceAttribute>\n    <ResourceAttribute name='Polling Start Date' displayName='com.waveset.adapter.RAMessages:RESATTR_SCHEDULE_START_DATE' type='string' multi='false' \n      description='com.waveset.adapter.RAMessages:RESATTR_HELP_54'>\n    </ResourceAttribute>\n    <ResourceAttribute name='assignSourceOnCreate' displayName='com.waveset.adapter.RAMessages:RESATTR_ASSIGN_SOURCE_ON_CREATE' type='boolean' multi='false' \n      description='com.waveset.adapter.RAMessages:RESATTR_ASSIGN_SOURCE_ON_CREATE_HELP' facets='activesync' value='true'>\n    </ResourceAttribute>\n" + "  </ResourceAttributes>\n" + "  <Template>\n" + "    <AttrDef name='accountId' type='string' />\n" + "  </Template>\n" + "  <AccountAttributeTypes>\n" + "  </AccountAttributeTypes>\n" + "  <LoginConfigEntry name='" + "com.waveset.security.authn.WSResourceLoginModule" + "' type='" + "ScriptedJDBC" + "' displayName='" + "com.waveset.adapter.RAMessages:RES_LOGIN_MOD_SCRIPTEDJDBC" + "'>\n" + "    <AuthnProperties>\n" + "      <AuthnProperty name='" + "scriptdb_user" + "' displayName='" + "com.waveset.adapter.RAMessages:UI_USERID_LABEL" + "' formFieldType='text' isId='true' />\n" + "      <AuthnProperty name='" + "scriptdb_password" + "' displayName='" + "com.waveset.adapter.RAMessages:UI_PWD_LABEL" + "' formFieldType='password'/>\n" + "    </AuthnProperties>\n" + "    <SupportedApplications>\n" + "      <SupportedApplication name='" + "Administrator Interface" + "'/>\n" + "      <SupportedApplication name='" + "User Interface" + "'/>\n" + "    </SupportedApplications>\n" + "  </LoginConfigEntry>\n" + "  <ResourceUserForm>\n" + "    <ObjectRef id='" + "#ID#" + "Scripted JDBC User Form" + "' type='" + "UserForm" + "'/>\n" + "  </ResourceUserForm>\n" + "</Resource>\n";
/*      */ 
/*      */   public ScriptedJdbcResourceAdapter()
/*      */   {
/*  152 */     this._util = null;
/*      */   }
/*      */ 
/*      */   private ResourceAdapterProxy getProxy()
/*      */   {
/*  161 */     if (this._proxy == null) {
/*  162 */       this._proxy = new ResourceAdapterProxy(this);
/*      */     }
/*  164 */     return this._proxy;
/*      */   }
/*      */ 
/*      */   public static Resource staticCreatePrototypeResource()
/*      */     throws WavesetException
/*      */   {
/*  310 */     Resource res = new Resource(prototypeXml);
/*      */ 
/*  316 */     res.disableFeature("CONTINUE_ON_ERROR");
/*      */ 
/*  318 */     return res;
/*      */   }
/*      */ 
/*      */   public Resource createPrototypeResource() throws WavesetException {
/*  322 */     return staticCreatePrototypeResource();
/*      */   }
/*      */ 
/*      */   public void startConnection()
/*      */     throws WavesetException
/*      */   {
/*      */   }
/*      */ 
/*      */   public void stopConnection()
/*      */     throws WavesetException
/*      */   {
/*      */   }
/*      */ 
/*      */   public WavesetResult checkCreateAccount(WSUser user) throws WavesetException
/*      */   {
/*  337 */     return new WavesetResult();
/*      */   }
/*      */ 
/*      */   public WavesetResult checkUpdateAccount(WSUser user) throws WavesetException
/*      */   {
/*  342 */     return new WavesetResult();
/*      */   }
/*      */ 
/*      */   public WavesetResult checkDeleteAccount(WSUser user) throws WavesetException
/*      */   {
/*  347 */     return new WavesetResult();
/*      */   }
/*      */ 
/*      */   public WSUser getUser(WSUser user)
/*      */     throws WavesetException
/*      */   {
/*  371 */     String METHOD = "getUser";
/*  372 */     TRACE.entry1("getUser");
/*      */ 
/*  374 */     String identity = getIdentity(user);
/*  375 */     List attrsToGet = computeSchemaAttributes();
/*      */ 
/*  377 */     WSUser newUser = null;
/*      */ 
/*  382 */     Map userInfo = getUserInfo(identity, attrsToGet);
/*      */ 
/*  384 */     Map attrMap = (Map)userInfo.get("attrMap");
/*  385 */     if ((attrMap != null) && (attrMap.size() > 0)) {
/*  386 */       TRACE.info3("getUser", "Returned Direct Map : {0}", attrMap);
/*      */     }
/*      */     else {
/*  389 */       TRACE.info3("getUser", "User {0} not found.", identity);
/*      */     }
/*      */ 
/*  392 */     boolean isDisabled = false;
/*      */ 
/*  396 */     Object isDisabledObj = userInfo.get("isDisabled");
/*  397 */     if (isDisabledObj != null) {
/*  398 */       Boolean b = Boolean.valueOf(isDisabledObj.toString());
/*  399 */       isDisabled = b.booleanValue();
/*      */     }
/*      */ 
/*  405 */     if (attrMap != null) {
/*  406 */       newUser = createWSUserFromAttributes(identity, isDisabled, attrMap);
/*      */     }
/*      */ 
/*  409 */     TRACE.exit1("getUser");
/*  410 */     return newUser;
/*      */   }
/*      */ 
/*      */   protected void realCreate(WSUser user, WavesetResult result) throws WavesetException {
/*  414 */     realCreateOrUpdate(user, result, "createUser");
/*      */   }
/*      */ 
/*      */   protected void realUpdate(WSUser user, WavesetResult result) throws WavesetException {
/*  418 */     realCreateOrUpdate(user, result, "updateUser");
/*      */   }
/*      */ 
/*      */   protected void realDelete(WSUser user, WavesetResult result) throws WavesetException
/*      */   {
/*  423 */     String METHOD = "realDelete";
/*  424 */     TRACE.entryMsg1("realDelete", "name={0}", user == null ? "?" : user.getName());
/*      */ 
/*  426 */     String identity = getIdentity(user);
/*      */ 
/*  431 */     Connection con = getConnection();
/*      */ 
/*  436 */     Map actionContext = new HashMap();
/*  437 */     actionContext.put("conn", con);
/*  438 */     actionContext.put("adapter", this);
/*  439 */     actionContext.put("action", "deleteUser");
/*  440 */     actionContext.put("trace", TRACE);
/*  441 */     actionContext.put("id", identity);
/*  442 */     List errorList = new ArrayList();
/*  443 */     actionContext.put("errors", errorList);
/*      */ 
/*  445 */     Map inputMap = new HashMap();
/*  446 */     inputMap.put("actionContext", actionContext);
/*      */     try
/*      */     {
/*  452 */       List actionScripts = getResourceAttributeActions("DeleteUser Actions", true);
/*      */ 
/*  454 */       ScriptExecutorFactory factory = new ScriptExecutorFactory(inputMap);
/*      */ 
/*  456 */       for (int i = 0; (actionScripts != null) && (i < actionScripts.size()); i++) {
/*  457 */         ActionScript actionScript = (ActionScript)actionScripts.get(i);
/*  458 */         ScriptExecutor executor = factory.getScriptExecutor(actionScript.scriptType);
/*  459 */         executor.evaluate(actionScript.script, actionScript.actionName);
/*      */ 
/*  461 */         if ((errorList != null) && (errorList.size() > 0))
/*      */         {
/*      */           break;
/*      */         }
/*      */       }
/*      */     }
/*      */     catch (Throwable e)
/*      */     {
/*  469 */       result.addException(e);
/*  470 */       destroyConnection(con);
/*  471 */       con = null;
/*      */     }
/*      */     finally {
/*  474 */       if (con != null) {
/*  475 */         closeConnection(con);
/*      */       }
/*      */     }
/*      */ 
/*  479 */     if ((errorList != null) && (errorList.size() > 0))
/*      */     {
/*  483 */       for (int ierror = 0; ierror < errorList.size(); ierror++) {
/*  484 */         Object err = errorList.get(ierror);
/*  485 */         ErrorMessage msg = null;
/*      */ 
/*  487 */         if ((err instanceof Message)) {
/*  488 */           if ((err instanceof ErrorMessage)) {
/*  489 */             msg = (ErrorMessage)err;
/*      */           } else {
/*  491 */             msg = new ErrorMessage((Message)err);
/*  492 */             msg.setSeverity(Severity.ERROR);
/*      */           }
/*      */         }
/*  495 */         else msg = new ErrorMessage(Severity.ERROR, "com.waveset.adapter.RAMessages:SH_GENERIC_ERROR", err.toString());
/*      */ 
/*  499 */         result.addError(msg);
/*      */       }
/*      */     }
/*      */ 
/*  503 */     TRACE.exit1("realDelete");
/*      */   }
/*      */ 
/*      */   protected void realEnable(WSUser user, WavesetResult result) throws WavesetException
/*      */   {
/*  508 */     String METHOD = "realEnable";
/*  509 */     TRACE.entryMsg1("realEnable", "name={0}", user == null ? "?" : user.getName());
/*      */ 
/*  511 */     String identity = getIdentity(user);
/*      */ 
/*  513 */     List errorList = new ArrayList();
/*  514 */     Connection con = null;
/*      */     try
/*      */     {
/*  521 */       con = getConnection();
/*      */ 
/*  526 */       Map actionContext = new HashMap();
/*  527 */       actionContext.put("conn", con);
/*  528 */       actionContext.put("adapter", this);
/*  529 */       actionContext.put("action", "enableUser");
/*  530 */       actionContext.put("trace", TRACE);
/*  531 */       actionContext.put("id", identity);
/*  532 */       actionContext.put("errors", errorList);
/*      */ 
/*  534 */       Map inputMap = new HashMap();
/*  535 */       inputMap.put("actionContext", actionContext);
/*      */ 
/*  541 */       List actionScripts = getResourceAttributeActions("EnableUser Actions", true);
/*      */ 
/*  543 */       ScriptExecutorFactory factory = new ScriptExecutorFactory(inputMap);
/*      */ 
/*  545 */       for (int i = 0; (actionScripts != null) && (i < actionScripts.size()); i++) {
/*  546 */         ActionScript actionScript = (ActionScript)actionScripts.get(i);
/*  547 */         ScriptExecutor executor = factory.getScriptExecutor(actionScript.scriptType);
/*  548 */         executor.evaluate(actionScript.script, actionScript.actionName);
/*      */ 
/*  550 */         if ((errorList != null) && (errorList.size() > 0)) {
/*      */           break;
/*      */         }
/*      */       }
/*      */     }
/*      */     catch (Throwable e)
/*      */     {
/*  557 */       result.addException(e);
/*  558 */       destroyConnection(con);
/*  559 */       con = null;
/*      */     }
/*      */     finally {
/*  562 */       if (con != null) {
/*  563 */         closeConnection(con);
/*      */       }
/*      */     }
/*      */ 
/*  567 */     if ((errorList != null) && (errorList.size() > 0))
/*      */     {
/*  571 */       for (int ierror = 0; ierror < errorList.size(); ierror++) {
/*  572 */         Object err = errorList.get(ierror);
/*  573 */         ErrorMessage msg = null;
/*      */ 
/*  575 */         if ((err instanceof Message)) {
/*  576 */           if ((err instanceof ErrorMessage)) {
/*  577 */             msg = (ErrorMessage)err;
/*      */           } else {
/*  579 */             msg = new ErrorMessage((Message)err);
/*  580 */             msg.setSeverity(Severity.ERROR);
/*      */           }
/*      */         }
/*  583 */         else msg = new ErrorMessage(Severity.ERROR, "com.waveset.adapter.RAMessages:SH_GENERIC_ERROR", err.toString());
/*      */ 
/*  587 */         result.addError(msg);
/*      */       }
/*      */ 
/*      */     }
/*      */ 
/*  595 */     if (!result.hasError()) {
/*  596 */       ResourceInfo resInfo = user.getResourceInfo(this._resource.getName());
/*  597 */       if (resInfo != null) {
/*  598 */         resInfo.setDisabled(false);
/*      */       }
/*      */     }
/*      */ 
/*  602 */     TRACE.exit1("realEnable");
/*      */   }
/*      */ 
/*      */   protected void realDisable(WSUser user, WavesetResult result)
/*      */     throws WavesetException
/*      */   {
/*  608 */     String METHOD = "realDisable";
/*  609 */     TRACE.entryMsg1("realDisable", "name={0}", user == null ? "?" : user.getName());
/*      */ 
/*  611 */     String identity = getIdentity(user);
/*      */ 
/*  613 */     List errorList = new ArrayList();
/*  614 */     Connection con = null;
/*      */     try
/*      */     {
/*  621 */       con = getConnection();
/*      */ 
/*  626 */       Map actionContext = new HashMap();
/*  627 */       actionContext.put("conn", con);
/*  628 */       actionContext.put("adapter", this);
/*  629 */       actionContext.put("action", "disableUser");
/*  630 */       actionContext.put("trace", TRACE);
/*  631 */       actionContext.put("id", identity);
/*  632 */       actionContext.put("errors", errorList);
/*      */ 
/*  634 */       Map inputMap = new HashMap();
/*  635 */       inputMap.put("actionContext", actionContext);
/*      */ 
/*  640 */       List actionScripts = getResourceAttributeActions("DisableUser Actions", true);
/*      */ 
/*  642 */       ScriptExecutorFactory factory = new ScriptExecutorFactory(inputMap);
/*      */ 
/*  644 */       for (int i = 0; (actionScripts != null) && (i < actionScripts.size()); i++) {
/*  645 */         ActionScript actionScript = (ActionScript)actionScripts.get(i);
/*  646 */         ScriptExecutor executor = factory.getScriptExecutor(actionScript.scriptType);
/*  647 */         executor.evaluate(actionScript.script, actionScript.actionName);
/*      */ 
/*  649 */         if (errorList.size() > 0)
/*      */         {
/*      */           break;
/*      */         }
/*      */       }
/*      */     }
/*      */     catch (Throwable e)
/*      */     {
/*  657 */       result.addException(e);
/*  658 */       destroyConnection(con);
/*  659 */       con = null;
/*      */     }
/*      */     finally {
/*  662 */       if (con != null) {
/*  663 */         closeConnection(con);
/*      */       }
/*      */     }
/*      */ 
/*  667 */     if (errorList.size() > 0)
/*      */     {
/*  671 */       for (int ierror = 0; ierror < errorList.size(); ierror++) {
/*  672 */         Object err = errorList.get(ierror);
/*  673 */         ErrorMessage msg = null;
/*      */ 
/*  675 */         if ((err instanceof Message)) {
/*  676 */           if ((err instanceof ErrorMessage)) {
/*  677 */             msg = (ErrorMessage)err;
/*      */           } else {
/*  679 */             msg = new ErrorMessage((Message)err);
/*  680 */             msg.setSeverity(Severity.ERROR);
/*      */           }
/*      */         }
/*  683 */         else msg = new ErrorMessage(Severity.ERROR, "com.waveset.adapter.RAMessages:SH_GENERIC_ERROR", err.toString());
/*      */ 
/*  687 */         result.addError(msg);
/*      */       }
/*      */ 
/*      */     }
/*      */ 
/*  696 */     if (!result.hasError()) {
/*  697 */       ResourceInfo resInfo = user.getResourceInfo(this._resource.getName());
/*  698 */       if (resInfo != null) {
/*  699 */         resInfo.setDisabled(true);
/*      */       }
/*      */     }
/*      */ 
/*  703 */     TRACE.exit1("realDisable");
/*      */   }
/*      */ 
/*      */   public boolean supportsActions() {
/*  707 */     return true;
/*      */   }
/*      */ 
/*      */   public WavesetResult run(ResourceAction action, Map args)
/*      */     throws WavesetException
/*      */   {
/*  719 */     String METHOD = "run";
/*  720 */     TRACE.entry1("run");
/*      */ 
/*  722 */     WavesetResult result = new WavesetResult();
/*      */ 
/*  724 */     ResourceAdapterProxy proxy = getProxy();
/*  725 */     if (!proxy.isSupported("ACTIONS")) {
/*  726 */       result = proxy.getUnsupportedFeatureResult("ACTIONS");
/*      */     }
/*      */     else {
/*  729 */       if (action == null)
/*      */       {
/*  731 */         InvalidArgument ia = new InvalidArgument("ResourceAction cannot be null.");
/*  732 */         TRACE.throwing1("run", ia);
/*  733 */         throw ia;
/*      */       }
/*      */ 
/*  736 */       String actionName = action.getName();
/*  737 */       if ((actionName == null) || (actionName.length() == 0)) {
/*  738 */         actionName = "unknown";
/*      */       }
/*      */ 
/*  741 */       String resType = this._resource.getTypeString();
/*  742 */       TRACE.info3("run", "resType is {0}", resType);
/*  743 */       String scriptText = action.getAction(resType);
/*  744 */       String scriptType = action.getActionType(resType);
/*  745 */       if ((scriptText == null) || (scriptText.length() == 0)) {
/*  746 */         TRACE.info3("run", "Check the action type (scriptText was {0}): {1}", scriptText == null ? "null" : "empty", actionName);
/*  747 */         Message errMsg = new Message("com.waveset.adapter.RAMessages:SCR_ACTION_NO_TEXT", actionName);
/*  748 */         WavesetException we = new WavesetException(errMsg);
/*  749 */         TRACE.throwing1("run", we);
/*  750 */         throw we;
/*      */       }
/*  752 */       if ((scriptType == null) || (scriptType.length() == 0)) {
/*  753 */         Message errMsg = new Message("com.waveset.adapter.RAMessages:SCR_ACTION_NO_TYPE", actionName);
/*  754 */         WavesetException we = new WavesetException(errMsg);
/*  755 */         TRACE.throwing1("run", we);
/*  756 */         throw we;
/*      */       }
/*      */ 
/*  759 */       ActionScript actionScript = new ActionScript();
/*  760 */       actionScript.actionName = actionName;
/*  761 */       actionScript.script = scriptText;
/*  762 */       actionScript.scriptType = scriptType;
/*      */ 
/*  764 */       Connection con = null;
/*      */       try
/*      */       {
/*  771 */         con = getConnection();
/*      */ 
/*  776 */         Map actionContext = new HashMap();
/*  777 */         actionContext.put("conn", con);
/*  778 */         actionContext.put("adapter", this);
/*  779 */         actionContext.put("action", "run");
/*  780 */         actionContext.put("trace", TRACE);
/*  781 */         actionContext.put("additionalArgs", args);
/*  782 */         actionContext.put("result", result);
/*      */ 
/*  784 */         Map inputMap = new HashMap();
/*  785 */         inputMap.put("actionContext", actionContext);
/*      */ 
/*  787 */         ScriptExecutorFactory factory = new ScriptExecutorFactory(inputMap);
/*      */ 
/*  789 */         ScriptExecutor executor = factory.getScriptExecutor(actionScript.scriptType);
/*  790 */         executor.evaluate(actionScript.script, actionScript.actionName);
/*      */       }
/*      */       catch (Throwable e) {
/*  793 */         TRACE.caught1("run", e);
/*  794 */         result.addException(e);
/*  795 */         destroyConnection(con);
/*  796 */         con = null;
/*      */       } finally {
/*  798 */         if (con != null) {
/*  799 */           closeConnection(con);
/*      */         }
/*      */       }
/*      */     }
/*      */ 
/*  804 */     TRACE.exit1("run");
/*  805 */     return result;
/*      */   }
/*      */ 
/*      */   public WavesetResult authenticate(HashMap loginInfo) throws WavesetException {
/*  809 */     String METHOD = "authenticate";
/*      */ 
/*  811 */     TRACE.entryMsg1("authenticate", "loginInfo={0}", loginInfo);
/*      */ 
/*  813 */     WavesetResult result = new WavesetResult();
/*      */ 
/*  815 */     String accountId = (String)loginInfo.get("scriptdb_user");
/*  816 */     EncryptedData encryptedPassword = (EncryptedData)loginInfo.get("scriptdb_password");
/*      */ 
/*  818 */     String password = null;
/*  819 */     if (encryptedPassword != null) {
/*  820 */       password = encryptedPassword.decryptToString();
/*      */     }
/*      */ 
/*  824 */     List errorList = new ArrayList();
/*  825 */     HashMap resultMap = new HashMap();
/*  826 */     Connection con = null;
/*      */     try
/*      */     {
/*  833 */       con = getConnection();
/*      */ 
/*  838 */       Map actionContext = new HashMap();
/*  839 */       actionContext.put("conn", con);
/*  840 */       actionContext.put("adapter", this);
/*  841 */       actionContext.put("action", "authenticateUser");
/*  842 */       actionContext.put("trace", TRACE);
/*  843 */       actionContext.put("id", accountId);
/*  844 */       actionContext.put("password", password);
/*  845 */       actionContext.put("errors", errorList);
/*  846 */       actionContext.put("result", resultMap);
/*      */ 
/*  848 */       Map inputMap = new HashMap();
/*  849 */       inputMap.put("actionContext", actionContext);
/*      */ 
/*  854 */       List actionScripts = getResourceAttributeActions("AuthUser Actions", true);
/*      */ 
/*  856 */       ScriptExecutorFactory factory = new ScriptExecutorFactory(inputMap);
/*      */ 
/*  858 */       for (int i = 0; (actionScripts != null) && (i < actionScripts.size()); i++) {
/*  859 */         ActionScript actionScript = (ActionScript)actionScripts.get(i);
/*  860 */         ScriptExecutor executor = factory.getScriptExecutor(actionScript.scriptType);
/*  861 */         executor.evaluate(actionScript.script, actionScript.actionName);
/*      */ 
/*  863 */         if (errorList.size() > 0)
/*      */         {
/*      */           break;
/*      */         }
/*      */       }
/*      */     }
/*      */     catch (Throwable e)
/*      */     {
/*  871 */       destroyConnection(con);
/*  872 */       con = null;
/*  873 */       WavesetException we = new WavesetException(e);
/*  874 */       TRACE.throwing1("authenticate", we);
/*  875 */       throw we;
/*      */     }
/*      */     finally {
/*  878 */       if (con != null) {
/*  879 */         closeConnection(con);
/*      */       }
/*      */     }
/*      */ 
/*  883 */     if (errorList.size() > 0)
/*      */     {
/*  887 */       WavesetException we = new WavesetException();
/*  888 */       for (int ierror = 0; ierror < errorList.size(); ierror++) {
/*  889 */         Object err = errorList.get(ierror);
/*  890 */         if ((err instanceof Message)) {
/*  891 */           we.addMessage((Message)err);
/*      */         }
/*      */         else {
/*  894 */           we.addMessage(new Message(err.toString()));
/*      */         }
/*      */       }
/*  897 */       TRACE.throwing1("authenticate", we);
/*  898 */       throw we;
/*      */     }
/*      */ 
/*  905 */     result.addResult("AUTHENTICATED_IDENTITY", accountId);
/*      */ 
/*  910 */     if (resultMap.get("expired") != null) {
/*  911 */       Object expiredObj = resultMap.get("expired");
/*  912 */       if ((expiredObj instanceof Boolean)) {
/*  913 */         result.addResult("resourcepasswordexpired", expiredObj);
/*      */       }
/*      */     }
/*      */ 
/*  917 */     TRACE.exit1("authenticate");
/*  918 */     return result;
/*      */   }
/*      */ 
/*      */   public GenericObject getFeatures() {
/*  922 */     String METHOD = "getFeatures()";
/*  923 */     TRACE.entry1("getFeatures()");
/*  924 */     GenericObject features = super.getFeatures();
/*      */ 
/*  930 */     if (getResAttrVals("CreateUser Actions") == null) {
/*  931 */       features.remove("account.CREATE");
/*      */     }
/*      */     else {
/*  934 */       features.put("account.CREATE", "account.CREATE");
/*      */     }
/*      */ 
/*  941 */     if (getResAttrVals("UpdateUser Actions") == null) {
/*  942 */       features.remove("account.UPDATE");
/*  943 */       features.remove("account.RENAME");
/*  944 */       features.remove("account.PASSWORD");
/*      */     }
/*      */     else {
/*  947 */       features.put("account.UPDATE", "account.UPDATE");
/*  948 */       features.put("account.RENAME", "account.RENAME");
/*  949 */       features.put("account.PASSWORD", "account.PASSWORD");
/*      */     }
/*      */ 
/*  955 */     if (getResAttrVals("DeleteUser Actions") == null) {
/*  956 */       features.remove("account.DELETE");
/*      */     }
/*      */     else {
/*  959 */       features.put("account.DELETE", "account.DELETE");
/*      */     }
/*      */ 
/*  965 */     if (getResAttrVals("ListAll Actions") == null) {
/*  966 */       features.remove("account.LIST");
/*      */     }
/*      */     else {
/*  969 */       features.put("account.LIST", "account.LIST");
/*      */     }
/*      */ 
/*  976 */     if ((getResAttrVals("ListAll Actions") == null) && (getResAttrVals("AccountIterator Actions") == null)) {
/*  977 */       features.remove("account.ITERATOR");
/*  978 */       features.remove("CONTINUE_ON_ERROR");
/*      */     }
/*      */     else {
/*  981 */       features.put("account.ITERATOR", "account.ITERATOR");
/*  982 */       features.put("CONTINUE_ON_ERROR", "CONTINUE_ON_ERROR");
/*      */     }
/*      */ 
/*  988 */     if (getResAttrVals("DisableUser Actions") == null) {
/*  989 */       features.remove("account.DISABLE");
/*      */     }
/*      */     else {
/*  992 */       features.put("account.DISABLE", "account.DISABLE");
/*      */     }
/*      */ 
/*  998 */     if (getResAttrVals("EnableUser Actions") == null) {
/*  999 */       features.remove("account.ENABLE");
/*      */     }
/*      */     else {
/* 1002 */       features.put("account.ENABLE", "account.ENABLE");
/*      */     }
/*      */ 
/* 1008 */     if (getResAttrVals("AuthUser Actions") == null) {
/* 1009 */       features.remove("account.LOGIN");
/*      */     }
/*      */     else {
/* 1012 */       features.put("account.LOGIN", "account.LOGIN");
/*      */     }
/*      */ 
/* 1019 */     if ((getResAttrVals("GetUser Actions") != null) || (features.get("account.ITERATOR") != null)) {
/* 1020 */       features.put("account.REPORTS_DISABLED", "account.REPORTS_DISABLED");
/*      */     }
/*      */ 
/* 1023 */     features.put("account.BINARY", "account.BINARY");
/*      */ 
/* 1025 */     TRACE.exit1("getFeatures()");
/* 1026 */     return features;
/*      */   }
/*      */ 
/*      */   public boolean supportsAccountDisable() {
/* 1030 */     String METHOD = "supportsAccountDisable()";
/* 1031 */     TRACE.entry1("supportsAccountDisable()");
/* 1032 */     boolean retval = (getResAttrVals("DisableUser Actions") != null) && (getResAttrVals("EnableUser Actions") != null);
/*      */ 
/* 1034 */     TRACE.exit1("supportsAccountDisable()", retval);
/* 1035 */     return retval;
/*      */   }
/*      */ 
/*      */   private Map getUserInfo(String identity, List attrsToGet)
/*      */     throws WavesetException
/*      */   {
/* 1052 */     String METHOD = "getUserInfo(String,List)";
/* 1053 */     TRACE.entryMsg3("getUserInfo(String,List)", "identity={0}", identity);
/* 1054 */     Map result = new HashMap();
/* 1055 */     Connection con = null;
/*      */     try
/*      */     {
/* 1058 */       con = getConnection();
/*      */ 
/* 1063 */       Map actionContext = new HashMap();
/* 1064 */       actionContext.put("conn", con);
/* 1065 */       actionContext.put("adapter", this);
/* 1066 */       actionContext.put("action", "getUser");
/* 1067 */       actionContext.put("id", identity);
/* 1068 */       List errorList = new ArrayList();
/* 1069 */       actionContext.put("errors", errorList);
/* 1070 */       actionContext.put("trace", TRACE);
/* 1071 */       actionContext.put("attrsToGet", attrsToGet);
/* 1072 */       actionContext.put("result", result);
/*      */ 
/* 1074 */       Map inputMap = new HashMap();
/* 1075 */       inputMap.put("actionContext", actionContext);
/*      */ 
/* 1077 */       List actionScripts = getResourceAttributeActions("GetUser Actions", true);
/*      */ 
/* 1079 */       ScriptExecutorFactory factory = new ScriptExecutorFactory(inputMap);
/*      */ 
/* 1081 */       for (int i = 0; (actionScripts != null) && (i < actionScripts.size()); i++) {
/* 1082 */         ActionScript actionScript = (ActionScript)actionScripts.get(i);
/* 1083 */         ScriptExecutor executor = factory.getScriptExecutor(actionScript.scriptType);
/* 1084 */         executor.evaluate(actionScript.script, actionScript.actionName);
/*      */ 
/* 1086 */         if (errorList.size() > 0)
/*      */         {
/*      */           break;
/*      */         }
/*      */       }
/*      */ 
/* 1092 */       if (errorList.size() > 0)
/*      */       {
/* 1097 */         if (errorList.size() == 1) {
/* 1098 */           WavesetException we = new WavesetException(errorList.get(0).toString());
/* 1099 */           TRACE.throwing3("getUserInfo(String,List)", we);
/* 1100 */           throw we;
/*      */         }
/*      */ 
/* 1103 */         WavesetException we = new WavesetException(errorList.toString());
/* 1104 */         TRACE.throwing3("getUserInfo(String,List)", we);
/* 1105 */         throw we;
/*      */       }
/*      */     }
/*      */     catch (WavesetException e)
/*      */     {
/* 1110 */       destroyConnection(con);
/* 1111 */       con = null;
/* 1112 */       TRACE.throwing3("getUserInfo(String,List)", e);
/* 1113 */       throw e;
/*      */     }
/*      */     catch (Throwable t) {
/* 1116 */       destroyConnection(con);
/* 1117 */       con = null;
/* 1118 */       WavesetException we = new WavesetException(t);
/* 1119 */       TRACE.throwing3("getUserInfo(String,List)", we);
/* 1120 */       throw we;
/*      */     }
/*      */     finally {
/* 1123 */       closeConnection(con);
/*      */     }
/* 1125 */     TRACE.exit3("getUserInfo(String,List)");
/* 1126 */     return result;
/*      */   }
/*      */ 
/*      */   public WSUser createWSUserFromAttributes(String identity, boolean isDisabled, Map attributeValues) throws WavesetException {
/* 1130 */     String METHOD = "createWSUserFromAttributes(String,boolean,Map)";
/* 1131 */     TRACE.entryMsg1("createWSUserFromAttributes(String,boolean,Map)", "identity={0}", identity);
/* 1132 */     WSUser newUser = null;
/* 1133 */     if (attributeValues != null) {
/* 1134 */       WSAttributes wsattrs = reverseMap(attributeValues);
/* 1135 */       newUser = new WSUser();
/* 1136 */       newUser.setWSAttributes(wsattrs);
/*      */ 
/* 1138 */       newUser.setAccountId(identity);
/*      */ 
/* 1143 */       ResourceInfo info = new ResourceInfo();
/* 1144 */       info.setResource(this._resource);
/* 1145 */       info.setAccountID(identity);
/* 1146 */       info.setDisabled(isDisabled);
/*      */ 
/* 1148 */       newUser.addResourceInfo(info);
/*      */     }
/* 1150 */     TRACE.exit1("createWSUserFromAttributes(String,boolean,Map)");
/* 1151 */     return newUser;
/*      */   }
/*      */ 
/*      */   public WSAttributes reverseMap(Map map)
/*      */     throws WavesetException
/*      */   {
/* 1162 */     String METHOD = "reverseMap(Map)";
/* 1163 */     TRACE.entry1("reverseMap(Map)");
/* 1164 */     WSAttributes mappedAttrs = new WSAttributes();
/*      */ 
/* 1166 */     AccountAttributeType[] attrTypes = this._resource.getAccountAttributeTypes();
/*      */ 
/* 1169 */     for (int j = 0; j < attrTypes.length; j++) {
/* 1170 */       AccountAttributeType attrType = attrTypes[j];
/* 1171 */       WSAttribute mappedAttr = getWSAttrFromMap(attrType, map, true);
/*      */ 
/* 1173 */       if (mappedAttr != null) {
/* 1174 */         mappedAttrs.put(mappedAttr);
/*      */       }
/*      */     }
/* 1177 */     TRACE.exit1("reverseMap(Map)");
/* 1178 */     return mappedAttrs;
/*      */   }
/*      */ 
/*      */   private List computeSchemaAttributes() throws WavesetException {
/* 1182 */     String METHOD = "computeSchemaAttributes()";
/* 1183 */     TRACE.entry3("computeSchemaAttributes()");
/* 1184 */     List attrs = new ArrayList();
/*      */ 
/* 1186 */     AccountAttributeType[] attrTypes = this._resource.getAccountAttributeTypes();
/*      */ 
/* 1188 */     for (int i = 0; i < attrTypes.length; i++) {
/* 1189 */       AccountAttributeType a = attrTypes[i];
/* 1190 */       String mapName = a.getMapName();
/* 1191 */       if (!"IGNORE_ATTR".equals(mapName)) {
/* 1192 */         attrs.add(mapName);
/*      */       }
/*      */     }
/* 1195 */     TRACE.exit3("computeSchemaAttributes()");
/* 1196 */     return attrs;
/*      */   }
/*      */ 
/*      */   protected List getResourceAttributeActions(String resAttrName, boolean required)
/*      */     throws WavesetException
/*      */   {
/* 1206 */     String METHOD = "getResourceAttributeActions(String,boolean)";
/* 1207 */     TRACE.entryMsg2("getResourceAttributeActions(String,boolean)", "resAttrName={0}", resAttrName);
/*      */ 
/* 1209 */     List actionScripts = new ArrayList();
/*      */     List actionNames;
/*      */     //List actionNames;
/* 1213 */     if (required) {
/* 1214 */       actionNames = getRequiredResAttrVals(resAttrName);
/*      */     }
/*      */     else {
/* 1217 */       actionNames = getResAttrVals(resAttrName);
/* 1218 */       if (actionNames == null) {
/* 1219 */         actionNames = new ArrayList();
/*      */       }
/*      */     }
/* 1222 */     Iterator i = actionNames.iterator();
/*      */ 
/* 1225 */     while (i.hasNext()) { String actionName = (String)i.next();
/*      */       ResourceAction action;
/*      */       try { action = lookupAction(actionName);
/*      */       } catch (ItemNotFound e) {
/* 1231 */         TRACE.caught2("getResourceAttributeActions(String,boolean)", e);
/* 1232 */         if (required) {
/* 1233 */           Message errMsg = new Message("com.waveset.adapter.RAMessages:SCR_ACTION_NOT_FOUND", actionName);
/* 1234 */           WavesetException we = new WavesetException(errMsg, e);
/* 1235 */           TRACE.throwing2("getResourceAttributeActions(String,boolean)", we);
/* 1236 */           throw we;
/*      */         }
/*      */ 
/* 1239 */         action = null;
/*      */       }
/*      */ 
/* 1242 */       if (action != null) {
/* 1243 */         String resType = this._resource.getTypeString();
/* 1244 */         TRACE.info3("getResourceAttributeActions(String,boolean)", "resType={0}", resType);
/* 1245 */         String scriptText = action.getAction(resType);
/* 1246 */         String scriptType = action.getActionType(resType);
/* 1247 */         if ((scriptText == null) || (scriptText.length() == 0)) {
/* 1248 */           TRACE.info3("getResourceAttributeActions(String,boolean)", "Check the action type (scriptText was {0}): {1}", scriptText == null ? "null" : "empty", actionName);
/* 1249 */           if (required) {
/* 1250 */             Message errMsg = new Message("com.waveset.adapter.RAMessages:SCR_ACTION_NO_TEXT", actionName);
/* 1251 */             WavesetException we = new WavesetException(errMsg);
/* 1252 */             TRACE.throwing2("getResourceAttributeActions(String,boolean)", we);
/* 1253 */             throw we;
/*      */           }
/*      */         } else {
/* 1256 */           if ((scriptType == null) || (scriptType.length() == 0)) {
/* 1257 */             Message errMsg = new Message("com.waveset.adapter.RAMessages:SCR_ACTION_NO_TYPE", actionName);
/* 1258 */             WavesetException we = new WavesetException(errMsg);
/* 1259 */             TRACE.throwing2("getResourceAttributeActions(String,boolean)", we);
/* 1260 */             throw we;
/*      */           }
/*      */ 
/* 1263 */           ActionScript actionScript = new ActionScript();
/* 1264 */           actionScript.actionName = actionName;
/* 1265 */           actionScript.script = scriptText;
/* 1266 */           actionScript.scriptType = scriptType;
/* 1267 */           actionScripts.add(actionScript);
/*      */         }
/*      */       }
/*      */     }
/*      */ 
/* 1272 */     if ((required) && (actionScripts.size() == 0)) {
/* 1273 */       Message errMsg = new Message("com.waveset.adapter.RAMessages:SCR_NO_ACTIONS_FOUND", resAttrName);
/* 1274 */       WavesetException we = new WavesetException(errMsg);
/* 1275 */       TRACE.throwing2("getResourceAttributeActions(String,boolean)", we);
/* 1276 */       throw we;
/*      */     }
/* 1278 */     TRACE.info4("getResourceAttributeActions(String,boolean)", "actionScripts={0}", actionScripts);
/* 1279 */     TRACE.exit2("getResourceAttributeActions(String,boolean)");
/* 1280 */     return actionScripts;
/*      */   }
/*      */ 
/*      */   public WavesetResult testConfiguration() throws WavesetException {
/* 1284 */     String METHOD = "testConfiguration";
/* 1285 */     TRACE.entry1("testConfiguration");
/* 1286 */     WavesetResult result = new WavesetResult();
/*      */ 
/* 1288 */     Connection conn = null;
/*      */     try {
/* 1290 */       conn = getConnection();
/*      */ 
/* 1292 */       Object testActions = getResAttrVals("Test Actions");
/*      */ 
/* 1294 */       if (testActions != null)
/*      */       {
/* 1296 */         List actionScripts = getResourceAttributeActions("Test Actions", true);
/*      */ 
/* 1301 */         Map actionContext = new HashMap();
/* 1302 */         actionContext.put("conn", conn);
/* 1303 */         actionContext.put("adapter", this);
/* 1304 */         actionContext.put("action", "test");
/* 1305 */         actionContext.put("trace", TRACE);
/* 1306 */         List errorList = new ArrayList();
/* 1307 */         actionContext.put("errors", errorList);
/*      */ 
/* 1309 */         Map inputMap = new HashMap();
/* 1310 */         inputMap.put("actionContext", actionContext);
/*      */ 
/* 1312 */         ScriptExecutorFactory factory = new ScriptExecutorFactory(inputMap);
/*      */ 
/* 1314 */         for (int i = 0; (actionScripts != null) && (i < actionScripts.size()); i++) {
/* 1315 */           ActionScript actionScript = (ActionScript)actionScripts.get(i);
/* 1316 */           ScriptExecutor executor = factory.getScriptExecutor(actionScript.scriptType);
/* 1317 */           executor.evaluate(actionScript.script, actionScript.actionName);
/*      */ 
/* 1319 */           if ((errorList == null) || (errorList.size() <= 0))
/*      */           {
/*      */             continue;
/*      */           }
/* 1323 */           for (int ierror = 0; ierror < errorList.size(); ierror++) {
/* 1324 */             Object err = errorList.get(ierror);
/* 1325 */             ErrorMessage msg = null;
/*      */ 
/* 1327 */             if ((err instanceof Message)) {
/* 1328 */               if ((err instanceof ErrorMessage)) {
/* 1329 */                 msg = (ErrorMessage)err;
/*      */               } else {
/* 1331 */                 msg = new ErrorMessage((Message)err);
/* 1332 */                 msg.setSeverity(Severity.ERROR);
/*      */               }
/*      */             }
/* 1335 */             else msg = new ErrorMessage(Severity.ERROR, "com.waveset.adapter.RAMessages:SH_GENERIC_ERROR", err.toString());
/*      */ 
/* 1339 */             result.addError(msg);
/*      */           }
/*      */         }
/*      */ 
/*      */       }
/*      */ 
/*      */     }
/*      */     catch (Throwable t)
/*      */     {
/* 1348 */       TRACE.caught1("testConfiguration", t);
/* 1349 */       result.addException(t);
/* 1350 */       destroyConnection(conn);
/* 1351 */       conn = null;
/*      */     }
/*      */     finally {
/* 1354 */       if (conn != null) {
/* 1355 */         closeConnection(conn);
/*      */       }
/*      */ 
/*      */     }
/*      */ 
/* 1363 */     List actionsToCheck = new ArrayList();
/* 1364 */     actionsToCheck.add("CreateUser Actions");
/* 1365 */     actionsToCheck.add("GetUser Actions");
/* 1366 */     actionsToCheck.add("DeleteUser Actions");
/* 1367 */     actionsToCheck.add("DisableUser Actions");
/* 1368 */     actionsToCheck.add("EnableUser Actions");
/* 1369 */     actionsToCheck.add("AccountIterator Actions");
/* 1370 */     actionsToCheck.add("ListAll Actions");
/* 1371 */     actionsToCheck.add("UpdateUser Actions");
/* 1372 */     actionsToCheck.add("ActiveSync Iterator Actions");
/* 1373 */     verifyActions(actionsToCheck, result);
/*      */ 
/* 1375 */     if (getResource().isActiveSync())
/*      */     {
/* 1381 */       verifyAction("ActiveSync Iterator Actions", result);
/*      */     }
/*      */ 
/* 1384 */     if (TRACE.level1("testConfiguration")) {
/* 1385 */       TRACE.info(0L, "testConfiguration", result.toXml());
/*      */     }
/* 1387 */     TRACE.exit1("testConfiguration");
/* 1388 */     return result;
/*      */   }
/*      */ 
/*      */   private String getPassword(WSUser user)
/*      */   {
/* 1396 */     String METHOD = "getPassword(WSUser)";
/* 1397 */     TRACE.entry3("getPassword(WSUser)");
/* 1398 */     if (user == null) return null;
/*      */ 
/* 1400 */     String password = null;
/* 1401 */     ResourceInfo resInfo = user.getResourceInfo(this._resource);
/* 1402 */     if (resInfo != null) {
/* 1403 */       EncryptedData ePassword = resInfo.getPassword();
/* 1404 */       if (ePassword != null) {
/* 1405 */         password = ePassword.decryptToString();
/*      */       }
/*      */     }
/*      */ 
/* 1409 */     TRACE.exit3("getPassword(WSUser)");
/* 1410 */     return password;
/*      */   }
/*      */ 
/*      */   private void verifyActions(List resAttrNames, WavesetResult result)
/*      */   {
/* 1415 */     String METHOD = "verifyActions(List,WavesetResult)";
/* 1416 */     TRACE.entry3("verifyActions(List,WavesetResult)");
/* 1417 */     for (int i = 0; (resAttrNames != null) && (i < resAttrNames.size()); i++) {
/* 1418 */       String resAttrName = (String)resAttrNames.get(i);
/* 1419 */       List attrVal = getResAttrVals(resAttrName);
/* 1420 */       if ((attrVal != null) && (attrVal.size() > 0)) {
/* 1421 */         verifyAction(resAttrName, result);
/*      */       }
/*      */     }
/* 1424 */     TRACE.exit3("verifyActions(List,WavesetResult)");
/*      */   }
/*      */ 
/*      */   private void verifyAction(String resAttrName, WavesetResult result) {
/* 1428 */     String METHOD = "verifyAction(String,WavesetResult)";
/* 1429 */     TRACE.entry3("verifyAction(String,WavesetResult)");
/*      */     try {
/* 1431 */       List actionScripts = getResourceAttributeActions(resAttrName, true);
/* 1432 */       ScriptExecutorFactory factory = new ScriptExecutorFactory(null);
/*      */ 
/* 1434 */       for (int i = 0; (actionScripts != null) && (i < actionScripts.size()); i++) {
/* 1435 */         ActionScript actionScript = (ActionScript)actionScripts.get(i);
/* 1436 */         ScriptExecutor executor = factory.getScriptExecutor(actionScript.scriptType);
/* 1437 */         executor.parse(actionScript.script, actionScript.actionName);
/*      */       }
/*      */     }
/*      */     catch (Throwable t) {
/* 1441 */       TRACE.caught3("verifyAction(String,WavesetResult)", t);
/* 1442 */       result.addException(t);
/*      */     }
/* 1444 */     TRACE.exit3("verifyAction(String,WavesetResult)");
/*      */   }
/*      */ 
/*      */   public ArrayList listAllObjects(String resourceObjectType, Map options, String runAsUser, EncryptedData runAsPassword)
/*      */     throws WavesetException
/*      */   {
/* 1464 */     String METHOD = "listAllObjects";
/* 1465 */     TRACE.entryMsg1("listAllObjects", "resourceObjectType={0}", resourceObjectType);
/*      */ 
/* 1467 */     ArrayList objectIdList = new ArrayList();
/*      */ 
/* 1472 */     getRequiredResAttrVals("ListAll Actions");
/*      */ 
/* 1474 */     Connection con = getConnection();
/*      */     try
/*      */     {
/* 1481 */       Map actionContext = new HashMap();
/* 1482 */       actionContext.put("conn", con);
/* 1483 */       actionContext.put("objectType", resourceObjectType);
/* 1484 */       actionContext.put("options", options);
/* 1485 */       actionContext.put("adapter", this);
/* 1486 */       actionContext.put("action", "listAllObjects");
/* 1487 */       actionContext.put("trace", TRACE);
/* 1488 */       List errorList = new ArrayList();
/* 1489 */       actionContext.put("errors", errorList);
/* 1490 */       List resultList = new ArrayList();
/* 1491 */       actionContext.put("resultList", resultList);
/*      */ 
/* 1493 */       Map inputMap = new HashMap();
/* 1494 */       inputMap.put("actionContext", actionContext);
/*      */ 
/* 1496 */       List actionScripts = getResourceAttributeActions("ListAll Actions", true);
/*      */ 
/* 1498 */       ScriptExecutorFactory factory = new ScriptExecutorFactory(inputMap);
/*      */ 
/* 1500 */       for (int i = 0; (actionScripts != null) && (i < actionScripts.size()); i++) {
/* 1501 */         ActionScript actionScript = (ActionScript)actionScripts.get(i);
/* 1502 */         ScriptExecutor executor = factory.getScriptExecutor(actionScript.scriptType);
/* 1503 */         executor.evaluate(actionScript.script, actionScript.actionName);
/*      */ 
/* 1505 */         if (errorList.size() > 0)
/*      */         {
/*      */           break;
/*      */         }
/*      */       }
/*      */ 
/* 1511 */       if (errorList.size() == 0)
/*      */       {
/* 1515 */         objectIdList.addAll(resultList);
/*      */       }
/*      */       else
/*      */       {
/* 1521 */         if (errorList.size() == 1) {
/* 1522 */           WavesetException we = new WavesetException(errorList.get(0).toString());
/* 1523 */           TRACE.throwing1("listAllObjects", we);
/* 1524 */           throw we;
/*      */         }
/*      */ 
/* 1527 */         WavesetException we = new WavesetException(errorList.toString());
/* 1528 */         TRACE.throwing1("listAllObjects", we);
/* 1529 */         throw we;
/*      */       }
/*      */     }
/*      */     catch (WavesetException e)
/*      */     {
/* 1534 */       destroyConnection(con);
/* 1535 */       con = null;
/* 1536 */       TRACE.throwing1("listAllObjects", e);
/* 1537 */       throw e;
/*      */     }
/*      */     catch (Throwable e) {
/* 1540 */       destroyConnection(con);
/* 1541 */       con = null;
/* 1542 */       WavesetException we = new WavesetException(e);
/* 1543 */       TRACE.throwing1("listAllObjects", we);
/* 1544 */       throw we;
/*      */     } finally {
/* 1546 */       if (con != null) {
/* 1547 */         closeConnection(con);
/*      */       }
/*      */     }
/*      */ 
/* 1551 */     if ((TRACE.level3("listAllObjects")) && 
/* 1552 */       (objectIdList != null)) {
/* 1553 */       for (int i = 0; i < objectIdList.size(); i++) {
/* 1554 */         TRACE.info(0L, "listAllObjects", "ListAllObjects: List[{0}] : {1}", Integer.valueOf(i), objectIdList.get(i));
/*      */       }
/*      */ 
/*      */     }
/*      */ 
/* 1559 */     TRACE.exit1("listAllObjects");
/* 1560 */     return objectIdList;
/*      */   }
/*      */ 
/*      */   protected void realCreateOrUpdate(WSUser user, WavesetResult result, String operation)
/*      */     throws WavesetException
/*      */   {
/* 1568 */     String METHOD = "realCreateOrUpdate";
/* 1569 */     TRACE.entryMsg1("realCreateOrUpdate", "operation={0}", operation);
/*      */  	System.out.println("realCreateOrUpdate is called  ---------:");
/* 1574 */     String identity = getIdentity(user);
/*      */ 
/* 1576 */     if (identity == null) {
/* 1577 */       ErrorMessage errMsg = new ErrorMessage(Severity.ERROR, "com.waveset.adapter.RAMessages:SCR_IDENTITY_INVALID", identity);
/*      */ 
/* 1579 */       if (TRACE.level1("realCreateOrUpdate")) {
/* 1580 */         TRACE.info(0L, "realCreateOrUpdate", errMsg.toString());
/*      */       }
/* 1582 */       result.addError(errMsg);
/* 1583 */       TRACE.exit1("realCreateOrUpdate");
/* 1584 */       return;
/*      */     }
/*      */ 
/* 1587 */     String newName = null;
/* 1588 */     if ("updateUser".equals(operation)) {
/* 1589 */       newName = user.getAttribute("ws_newAccountId");
/*      */     }
/*      */ 
/* 1595 */     String password = getPassword(user);
/*      */ 
/* 1600 */     Map userAttrMap = buildJavascriptAttrMap(user, operation);
/*      */ 
/* 1605 */     Connection con = getConnection();
/*      */ 
/* 1610 */     Map actionContext = new HashMap();
/* 1611 */     actionContext.put("conn", con);
/* 1612 */     actionContext.put("adapter", this);
/* 1613 */     actionContext.put("action", operation);
/* 1614 */     actionContext.put("trace", TRACE);
/* 1615 */     actionContext.put("id", identity);
/* 1616 */     if (password != null) {
/* 1617 */       actionContext.put("password", password);
/*      */     }
/* 1619 */     if (newName != null) {
/* 1620 */       actionContext.put("newId", newName);
/*      */     }
/* 1622 */     actionContext.put("attributes", userAttrMap);
/* 1623 */     List errorList = new ArrayList();
/* 1624 */     actionContext.put("errors", errorList);
/*      */ 
/* 1626 */     Map inputMap = new HashMap();
/* 1627 */     inputMap.put("actionContext", actionContext);
/*      */     try
/*      */     {
/*      */       String actionAttrName;
/*      */     // String actionAttrName;
/* 1631 */       if ("createUser".equals(operation)) {
/* 1632 */         actionAttrName = "CreateUser Actions";
/*      */       }
/*      */       else {
/* 1635 */         actionAttrName = "UpdateUser Actions";
/*      */       }
/*      */ 		 System.out.println("actionAttrName ---------:"+actionAttrName);
/* 1638 */       List actionScripts = getResourceAttributeActions(actionAttrName, true);
/*      */ 
/* 1640 */       ScriptExecutorFactory factory = new ScriptExecutorFactory(inputMap);
/*      */ 
/* 1642 */       for (int i = 0; (actionScripts != null) && (i < actionScripts.size()); i++) {
/* 1643 */         ActionScript actionScript = (ActionScript)actionScripts.get(i);
					System.out.println("actionScript ---------:"+actionScript.script);
					System.out.println("actionScript ---------:"+actionScript.actionName);
/* 1644 */         ScriptExecutor executor = factory.getScriptExecutor(actionScript.scriptType);
/* 1645 */         executor.evaluate(actionScript.script, actionScript.actionName);
/*      */ 
/* 1647 */         if ((errorList != null) && (errorList.size() > 0))
/*      */         {
/*      */           break;
/*      */         }
/*      */       }
/*      */ 
/* 1653 */       if (errorList.size() > 0)
/*      */       {
/* 1657 */         for (int ierror = 0; ierror < errorList.size(); ierror++) {
/* 1658 */           Object err = errorList.get(ierror);
/* 1659 */           ErrorMessage msg = null;
/*      */ 
/* 1661 */           if ((err instanceof Message)) {
/* 1662 */             if ((err instanceof ErrorMessage)) {
/* 1663 */               msg = (ErrorMessage)err;
/*      */             } else {
/* 1665 */               msg = new ErrorMessage((Message)err);
/* 1666 */               msg.setSeverity(Severity.ERROR);
/*      */             }
/*      */           }
/* 1669 */           else msg = new ErrorMessage(Severity.ERROR, "com.waveset.adapter.RAMessages:SH_GENERIC_ERROR", err.toString());
/*      */ 
/* 1673 */           result.addError(msg);
/*      */         }
/*      */       }
/*      */ 
/* 1677 */       if (!result.hasError())
/*      */       {
/* 1683 */         ResourceInfo resInfo = user.getResourceInfo(this._resource);
/*      */ 
/* 1685 */         if ((resInfo != null) && ("createUser".equals(operation))) {
/* 1686 */           resInfo.setAccountCreated(true);
/*      */         }
/*      */ 
/* 1689 */         if ((resInfo != null) && (newName != null)) {
/* 1690 */           resInfo.setAccountID(newName);
/* 1691 */           TRACE.info4("realCreateOrUpdate", "Account renamed to: {0}", newName);
/*      */         }
/*      */ 
/* 1699 */         if ((resInfo != null) && (password != null)) {
/* 1700 */           resInfo.setPassword((EncryptedData)null);
/*      */         }
/*      */       }
/*      */     }
/*      */     catch (Throwable t)
/*      */     {
/* 1706 */       ErrorMessage msg = new ErrorMessage(Severity.ERROR, "com.waveset.adapter.RAMessages:SH_GENERIC_ERROR", t.toString());
/*      */ 
/* 1708 */       TRACE.caught1("realCreateOrUpdate", t);
/* 1709 */       result.addError(msg);
/* 1710 */       destroyConnection(con);
/* 1711 */       con = null;
/*      */     }
/*      */     finally {
/* 1714 */       if (con != null) {
/* 1715 */         closeConnection(con);
/*      */       }
/*      */     }
/*      */ 
/* 1719 */     TRACE.info1("realCreateOrUpdate", "{0} user ''{1}'' complete", operation, identity);
/* 1720 */     TRACE.exit1("realCreateOrUpdate");
/*      */   }
/*      */ 
/*      */   private Map buildJavascriptAttrMap(WSUser user, String operation) throws WavesetException {
/* 1724 */     String METHOD = "buildJavascriptAttrMap(WSUser,String)";
/* 1725 */     TRACE.entryMsg3("buildJavascriptAttrMap(WSUser,String)", "operation={0}", operation);
/*      */ 
/* 1727 */     Map attrMap = new HashMap();
/*      */ 
/* 1729 */     AccountAttributeType[] attrTypes = this._resource.getAccountAttributeTypes();
/*      */ 
/* 1731 */     for (int i = 0; i < attrTypes.length; i++) {
/* 1732 */       AccountAttributeType attrType = attrTypes[i];
/* 1733 */       Syntax syntax = attrType.getSyntax();
/* 1734 */       String name = attrType.getName();
/* 1735 */       String mapName = attrType.getMapName();
/*      */ 
/* 1740 */       if ("IGNORE_ATTR".equalsIgnoreCase(mapName))
/*      */       {
/*      */         continue;
/*      */       }
/* 1744 */       AttributeValues values = null;
/*      */ 
/* 1746 */       WSAttribute wsAttr = user.getWSAttribute(name);
/* 1747 */       if (wsAttr != null) {
/* 1748 */         values = wsAttr.getAttrValues();
/* 1749 */         if (((values == null) || (values.size() == 0)) && (operation.equals("updateUser")))
/*      */         {
/* 1757 */           attrMap.put(mapName, null);
/* 1758 */           continue;
/*      */         }
/*      */ 
/*      */       }
/*      */ 
/* 1767 */       if (((values == null) || (values.size() == 0)) && (operation.equals("createUser"))) {
/* 1768 */         values = attrType.getAttrValues();
/* 1769 */         if (((values == null) || (values.size() == 0)) && 
/* 1770 */           (attrType.getRequired() == true)) {
/* 1771 */           Message msg = new Message("com.waveset.adapter.RAMessages:SH_MISSING_REQD_ATTR", name);
/* 1772 */           WavesetException we = new WavesetException(msg);
/* 1773 */           TRACE.throwing3("buildJavascriptAttrMap(WSUser,String)", we);
/* 1774 */           throw we;
/*      */         }
/*      */ 
/*      */       }
/*      */ 
/* 1779 */       if ((values != null) && (values.size() > 0))
/*      */       {
/* 1783 */         AttributeValues av = new AttributeValues();
/* 1784 */         for (int idx = 0; idx < values.size(); idx++) {
/* 1785 */           Object obj = values.get(idx);
/* 1786 */           String type = (String)values.getType(idx);
/* 1787 */           if ((obj instanceof EncryptedData)) {
/* 1788 */             Object decryptedObj = ((EncryptedData)obj).decryptToString();
/* 1789 */             av.add(type, decryptedObj);
/*      */           }
/*      */           else {
/* 1792 */             av.add(type, obj);
/*      */           }
/*      */         }
/* 1795 */         values = av;
/*      */       }
/*      */ 
/* 1798 */       if ((values != null) && (values.size() > 0)) {
/* 1799 */         String attrMapMode = (String)getRequiredResAttrVal(this._resource, "AttrMapMode");
/*      */ 
/* 1801 */         if ("Direct".equalsIgnoreCase(attrMapMode)) {
/* 1802 */           attrMap.put(mapName, values);
/*      */         }
/* 1804 */         else if ("Strings".equalsIgnoreCase(attrMapMode)) {
/* 1805 */           if (values.size() == 1) {
/* 1806 */             Object val = null;
/* 1807 */             if (Syntax.BINARY.equals(syntax))
/*      */             {
/* 1812 */               val = values.get(0);
/*      */             }
/*      */             else {
/* 1815 */               val = values.getAsString(0);
/*      */             }
/* 1817 */             attrMap.put(mapName, val);
/*      */           }
/*      */           else {
/* 1820 */             List valueList = new ArrayList();
/* 1821 */             for (int idx = 0; idx < values.size(); idx++) {
/* 1822 */               Object val = null;
/* 1823 */               if (Syntax.BINARY.equals(syntax))
/*      */               {
/* 1828 */                 val = values.get(idx);
/*      */               }
/*      */               else {
/* 1831 */                 val = values.getAsString(idx);
/*      */               }
/* 1833 */               valueList.add(val);
/*      */             }
/* 1835 */             attrMap.put(mapName, valueList);
/*      */           }
/*      */         }
/*      */         else {
/* 1839 */           Message msg = new Message("com.waveset.adapter.RAMessages:SH_INVALID_VALUE", attrMapMode, "AttrMapMode");
/* 1840 */           WavesetException we = new WavesetException(msg);
/* 1841 */           TRACE.throwing3("buildJavascriptAttrMap(WSUser,String)", we);
/* 1842 */           throw we;
/*      */         }
/*      */       }
/*      */     }
/* 1846 */     TRACE.exit3("buildJavascriptAttrMap(WSUser,String)");
/* 1847 */     return attrMap;
/*      */   }
/*      */ 
/*      */   public AccountIterator getAccountIterator()
/*      */     throws WavesetException
/*      */   {
/* 1862 */     return getAccountIterator("AccountIterator Actions", "getAccountIterator", null);
/*      */   }
/*      */ 
/*      */   public AccountIterator getAccountIterator(Map options)
/*      */     throws WavesetException
/*      */   {
/* 1870 */     return getAccountIterator("AccountIterator Actions", "getAccountIterator", options);
/*      */   }
/*      */ 
/*      */   private AccountIterator getAccountIterator(String resAttrName, String operation, Map options)
/*      */     throws WavesetException
/*      */   {
/* 1878 */     String METHOD = "getAccountIterator(String,String,Map)";
/* 1879 */     TRACE.entryMsg3("getAccountIterator(String,String,Map)", "resAttrName={0}, operation={1}", resAttrName, operation);
/*      */ 
/* 1881 */     AccountIterator acctIter = null;
/*      */ 
/* 1883 */     List iterAction = getResAttrVals(resAttrName);
/* 1884 */     if (((iterAction == null) || (iterAction.size() == 0)) && ((options == null) || (options.size() == 0)))
/*      */     {
/* 1892 */       acctIter = super.getAccountIterator();
/* 1893 */       TRACE.exit3("getAccountIterator(String,String,Map)");
/* 1894 */       return acctIter;
/*      */     }
/*      */ 
/* 1897 */     Connection conn = null;
/*      */     try {
/* 1899 */       conn = getConnection();
/*      */ 
/* 1904 */       Map actionContext = new HashMap();
/* 1905 */       actionContext.put("conn", conn);
/* 1906 */       actionContext.put("adapter", this);
/* 1907 */       actionContext.put("action", operation);
/* 1908 */       if (options != null) {
/* 1909 */         actionContext.put("options", options);
/*      */       }
/* 1911 */       actionContext.put("trace", TRACE);
/* 1912 */       if (operation.equals("getActiveSyncIterator")) {
/* 1913 */         actionContext.put("activeSyncLogger", this._util.getLogger());
/*      */       }
/* 1915 */       Map result = new HashMap();
/* 1916 */       actionContext.put("result", result);
/* 1917 */       List errorList = new ArrayList();
/* 1918 */       actionContext.put("errors", errorList);
/*      */ 
/* 1920 */       Map inputMap = new HashMap();
/* 1921 */       inputMap.put("actionContext", actionContext);
/*      */ 
/* 1923 */       List actionScripts = getResourceAttributeActions(resAttrName, true);
/*      */ 
/* 1925 */       ScriptExecutorFactory factory = new ScriptExecutorFactory(inputMap);
/* 1926 */       ScriptExecutor executor = null;
/*      */ 
/* 1928 */       for (int i = 0; (actionScripts != null) && (i < actionScripts.size()); i++) {
/* 1929 */         ActionScript actionScript = (ActionScript)actionScripts.get(i);
/* 1930 */         executor = factory.getScriptExecutor(actionScript.scriptType);
/* 1931 */         executor.evaluate(actionScript.script, actionScript.actionName);
/*      */ 
/* 1933 */         if ((errorList == null) || (errorList.size() <= 0))
/*      */         {
/*      */           continue;
/*      */         }
/* 1937 */         if (errorList.size() == 1) {
/* 1938 */           WavesetException we = new WavesetException(errorList.get(0).toString());
/* 1939 */           TRACE.throwing3("getAccountIterator(String,String,Map)", we);
/*      */           throw we;
/*      */         }
/*      */ 
/* 1943 */         WavesetException we = new WavesetException(errorList.toString());
/* 1944 */         TRACE.throwing3("getAccountIterator(String,String,Map)", we);
/*      */         throw we;
/*      */       }
/*      */ 
/* 1951 */       if (result.get("iterator") != null)
/*      */       {
/* 1955 */         Object scriptedIterObj = result.get("iterator");
/*      */ 
/* 1957 */         CloseListener closeListener = new ScriptedJdbcCloseListener(conn);
/*      */ 
/* 1959 */         acctIter = ScriptedAccountIteratorFactory.newScriptedAccountIterator(executor.getSupportedScriptType(), scriptedIterObj, this, closeListener);
/*      */       }
/*      */       else
/*      */       {
/* 1963 */         Message errMsg = new Message("com.waveset.adapter.RAMessages:SCR_NO_ITER_RETURNED");
/* 1964 */         WavesetException we = new WavesetException(errMsg);
/* 1965 */         TRACE.throwing3("getAccountIterator(String,String,Map)", we);
/*      */         throw we;
/*      */       }
/*      */ 
/*      */     }
/*      */     catch (WavesetException e)
/*      */     {
/* 1975 */       destroyConnection(conn);
/* 1976 */       conn = null;
/* 1977 */       TRACE.throwing3("getAccountIterator(String,String,Map)", e);
/*      */       throw e;
/*      */     }
/*      */     finally {
/*      */     }
/* 1982 */     TRACE.exit3("getAccountIterator(String,String,Map)");
/* 1983 */     return acctIter;
/*      */   }
/*      */ 
/*      */   public void init()
/*      */     throws Exception
/*      */   {
/* 2001 */     String METHOD = "init";
/* 2002 */     TRACE.entry1("init");
/*      */ 
/* 2004 */     this._util = new ActiveSyncUtil(getResource(), this);
/* 2005 */     traceAndLog(1L, "init", 2, "Initializing ScriptedJDBC resource adapter.\n");
/*      */ 
/* 2008 */     traceAndLog(1L, "init", 2, this._resource.toXml());
/* 2009 */     traceAndLog(1L, "init", 2, "Done initializing ScriptedJDBC resource adapter.\n");
/*      */ 
/* 2011 */     TRACE.exit1("init");
/*      */   }
/*      */ 
/*      */   public void shutdown()
/*      */   {
/*      */   }
/*      */ 
/*      */   public Object getAttributeValue(String name)
/*      */     throws WavesetException
/*      */   {
/* 2027 */     return getResource().getResourceAttributeVal(name);
/*      */   }
/*      */ 
/*      */   public void setAttributeValue(String name, Object value)
/*      */     throws WavesetException
/*      */   {
/* 2036 */     getResource().setResourceAttributeVal(name, value);
/*      */   }
/*      */ 
/*      */   public int poll()
/*      */   {
/* 2048 */     String METHOD = "poll";
/*      */ 
/* 2050 */     TRACE.entry1("poll");
/* 2051 */     StringBuffer tsb = new StringBuffer(48);
/* 2052 */     tsb.append("Starting poll for ");
/* 2053 */     tsb.append(getResource().getName());
/* 2054 */     tsb.append(" resource adapter.\n");
/* 2055 */     traceAndLog(1L, "poll", 2, tsb.toString());
/*      */ 
/* 2057 */     int numProcessed = 0;
/*      */     try
/*      */     {
/* 2064 */       IAPI prox = IAPIFactory.getIAPIProcess(null, null, null, this);
/* 2065 */       Map lastProcessedMap = ActiveSyncUtil.reconstituteEmptyStrings((Map)prox.getProperty("lastProcessed"));
/*      */ 
/* 2067 */       if (TRACE.level1("poll")) {
/* 2068 */         StringBuffer sb = new StringBuffer("lastProcessed map = ");
/* 2069 */         sb.append(lastProcessedMap);
/* 2070 */         TRACE.info(0L, "poll", sb.toString());
/*      */       }
/* 2072 */       if (this._util.getLogLevel() >= 2) {
/* 2073 */         this._util.logInfoMap("lastProcessed", lastProcessedMap);
/*      */       }
/*      */ 
/* 2080 */       List updates = getUpdatedRows(lastProcessedMap);
/*      */ 
/* 2082 */       if ((updates != null) && (updates.size() > 0)) {
/* 2083 */         numProcessed = updates.size();
/* 2084 */         traceAndLog(2L, "poll", 1, "Poll found " + numProcessed + " items to process.");
/*      */ 
/* 2087 */         processUpdates(updates, "update", prox);
/*      */       }
/*      */ 
/* 2090 */       if (numProcessed == 0) {
/* 2091 */         traceAndLog(1L, "poll", 2, "Poll found nothing to do");
/*      */       }
/*      */     }
/*      */     catch (Throwable th)
/*      */     {
/* 2096 */       this._util.logResourceException("Error processing updates", th, TRACE, "poll");
/*      */     }
/*      */ 
/* 2099 */     traceAndLog(1L, "poll", 2, "Completed poll for " + getResource().getName() + " resource adapter.\n");
/*      */ 
/* 2102 */     TRACE.exit1("poll", numProcessed);
/*      */ 
/* 2104 */     return numProcessed;
/*      */   }
/*      */ 
/*      */   protected void processUpdates(List updates, String command, IAPI prox)
/*      */     throws WavesetException, IAPIException
/*      */   {
/* 2115 */     String METHOD = "processUpdates";
/* 2116 */     TRACE.entry2("processUpdates");
/* 2117 */     if (TRACE.level2("processUpdates")) {
/* 2118 */       StringBuffer sb = new StringBuffer(64);
/* 2119 */       sb.append("updateRows=");
/* 2120 */       sb.append(updates);
/* 2121 */       sb.append("command=");
/* 2122 */       sb.append(command);
/* 2123 */       sb.append("prox=");
/* 2124 */       sb.append(prox);
/* 2125 */       TRACE.info2("processUpdates", sb.toString());
/*      */     }
/* 2127 */     if (updates != null) {
/* 2128 */       Iterator it = updates.iterator();
/* 2129 */       for (int i = 0; (it.hasNext()) && (!this._util.isStopRequested()); i++) {
/* 2130 */         Map userMap = (Map)it.next();
/*      */ 
/* 2132 */         traceAndLogCommand(3L, "processUpdates", 2, userMap, command, null);
/*      */ 
/* 2135 */         IAPI event = null;
/* 2136 */         Map options = new HashMap();
/* 2137 */         String adminName = (String)userMap.get("AUDIT_OPRID");
/* 2138 */         if (adminName != null) {
/* 2139 */           options.put("RemoteAdminName", adminName);
/*      */         }
/* 2141 */         event = IAPIFactory.getIAPI(options, userMap, this);
/*      */ 
/* 2143 */         if (event != null) {
/* 2144 */           WavesetResult result = event.submit();
/*      */ 
/* 2146 */           if (!result.hasError())
/*      */           {
/* 2151 */             prox.setProperty("lastProcessed", userMap);
/*      */           }
/*      */ 
/* 2155 */           traceAndLogCommand(3L, "processUpdates", 2, userMap, command, result);
/*      */         }
/*      */       }
/*      */ 
/*      */     }
/*      */ 
/* 2161 */     TRACE.exit2("processUpdates");
/*      */   }
/*      */ 
/*      */   private void destroyConnection(Connection con) {
/* 2165 */     String METHOD = "destroyConnection";
/* 2166 */     TRACE.entry3("destroyConnection");
/* 2167 */     if (TRACE.level3("destroyConnection")) {
/* 2168 */       StringBuffer sb = new StringBuffer(48);
/* 2169 */       sb.append("connection=");
/* 2170 */       sb.append(getConnectionString(con));
/* 2171 */       TRACE.info3("destroyConnection", sb.toString());
/*      */     }
/*      */     try
/*      */     {
/* 2175 */       if (con != null)
/* 2176 */         if ((con instanceof PooledConnection))
/*      */         {
/* 2180 */           PooledConnection pc = (PooledConnection)con;
/* 2181 */           pc.destroy();
/*      */         }
/*      */         else
/*      */         {
/*      */           try
/*      */           {
/* 2190 */             if (!con.getAutoCommit())
/* 2191 */               con.rollback();
/*      */           }
/*      */           catch (SQLException e)
/*      */           {
/* 2195 */             TRACE.caught3("destroyConnection", e);
/*      */           }
/*      */ 
/* 2199 */           con.close();
/*      */         }
/*      */     }
/*      */     catch (SQLException e)
/*      */     {
/* 2204 */       TRACE.caught3("destroyConnection", e);
/*      */     }
/*      */ 
/* 2207 */     TRACE.exit3("destroyConnection");
/*      */   }
/*      */ 
/*      */   public void closeConnection(Connection con)
/*      */   {
/* 2213 */     String METHOD = "closeConnection";
/* 2214 */     TRACE.entry1("closeConnection");
/* 2215 */     if (con != null) {
/*      */       try {
/* 2217 */         if (!con.getAutoCommit()) {
/* 2218 */           con.rollback();
/* 2219 */           con.setAutoCommit(true);
/*      */         }
/* 2221 */         super.closeConnection(con);
/*      */       } catch (SQLException e) {
/* 2223 */         if (TRACE.level3("closeConnection")) {
/* 2224 */           StringBuffer sb = new StringBuffer();
/* 2225 */           sb.append("WARNING: Exception closing JDBC connection.  Will destroy connection instead.");
/* 2226 */           sb.append(e.getMessage());
/* 2227 */           TRACE.info(0L, "closeConnection", sb.toString());
/*      */         }
/* 2229 */         destroyConnection(con);
/*      */       }
/*      */     }
/* 2232 */     TRACE.exit1("closeConnection");
/*      */   }
/*      */ 
/*      */   public Connection getConnection()
/*      */     throws WavesetException
/*      */   {
/* 2240 */     String METHOD = "getConnection()";
/* 2241 */     TRACE.entry1("getConnection()");
/* 2242 */     Connection conn = super.getConnection();
/* 2243 */     cleanupConnection(conn);
/* 2244 */     TRACE.exit1("getConnection()");
/* 2245 */     return conn;
/*      */   }
/*      */ 
/*      */   private void cleanupConnection(Connection con)
/*      */     throws WavesetException
/*      */   {
/* 2252 */     String METHOD = "cleanupConnection";
/* 2253 */     TRACE.entry3("cleanupConnection");
/* 2254 */     if (con != null)
/*      */     {
/* 2256 */       boolean isAutoCommit = true;
/*      */       try {
/* 2258 */         isAutoCommit = con.getAutoCommit();
/*      */       } catch (SQLException t) {
/* 2260 */         if (TRACE.level2("cleanupConnection")) {
/* 2261 */           TRACE.info(0L, "cleanupConnection", "Failed to call getAutoCommit() on {0}: {1}", getConnectionString(con), t);
/*      */         }
/*      */ 
/* 2265 */         WavesetException we = new WavesetException(t);
/* 2266 */         TRACE.throwing3("cleanupConnection", we);
/* 2267 */         throw we;
/*      */       }
/*      */ 
/* 2270 */       if (!isAutoCommit) {
/*      */         try {
/* 2272 */           con.rollback();
/*      */         } catch (SQLException t) {
/* 2274 */           if (TRACE.level2("cleanupConnection")) {
/* 2275 */             TRACE.info(0L, "cleanupConnection", "Failed to rollback a transacted connection {0}: {1}", getConnectionString(con), t);
/*      */           }
/*      */ 
/* 2279 */           WavesetException we = new WavesetException(t);
/* 2280 */           TRACE.throwing3("cleanupConnection", we);
/* 2281 */           throw we;
/*      */         }
/*      */         try
/*      */         {
/* 2285 */           if (TRACE.level4("cleanupConnection")) {
/* 2286 */             TRACE.info(0L, "cleanupConnection", "Forcing connection {0} back to autoCommit(true)", getConnectionString(con));
/*      */           }
/*      */ 
/* 2290 */           con.setAutoCommit(true);
/*      */         } catch (SQLException t) {
/* 2292 */           if (TRACE.level2("cleanupConnection")) {
/* 2293 */             TRACE.info(0L, "cleanupConnection", "Failed to set {0} auto commit to true: {1}", getConnectionString(con), t);
/*      */           }
/*      */ 
/* 2297 */           WavesetException we = new WavesetException(t);
/* 2298 */           TRACE.throwing3("cleanupConnection", we);
/* 2299 */           throw we;
/*      */         }
/*      */       }
/*      */     }
/* 2303 */     TRACE.exit3("cleanupConnection");
/*      */   }
/*      */ 
/*      */   List getUpdatedRows(Map lastProcessedMap)
/*      */   {
/* 2312 */     String METHOD = "getUpdatedRows";
/*      */ 
/* 2314 */     TRACE.entryMsg2("getUpdatedRows", "lastProcessedMap={0}", lastProcessedMap);
/*      */ 
/* 2316 */     List list = new ArrayList();
/*      */     try
/*      */     {
/* 2320 */       HashMap listOptions = new HashMap();
/* 2321 */       listOptions.put("lastProcessed", lastProcessedMap);
/*      */ 
/* 2323 */       TRACE.info1("getUpdatedRows", "listOptions map={0}", listOptions);
/* 2324 */       if (this._util.getLogLevel() >= 2) {
/* 2325 */         this._util.logInfoMap("listOptions", listOptions);
/*      */       }
/*      */ 
/* 2331 */       AccountIterator acctIter = getAccountIterator("ActiveSync Iterator Actions", "getActiveSyncIterator", listOptions);
/*      */ 
/* 2333 */       while ((acctIter.hasNext()) && (!this._util.isStopRequested())) {
/* 2334 */         WSUser user = acctIter.next();
/* 2335 */         if (user == null) {
/* 2336 */           this._util.logString(1, "Unexpected null user returned from active sync iterator ... ignoring.");
/* 2337 */           continue;
/*      */         }
/* 2339 */         Map userMap = user.toHashMap(true);
/* 2340 */         ResourceInfo ri = user.getResourceInfo(getResource());
/* 2341 */         if (ri != null) {
/* 2342 */           userMap.put("identity", ri.getAccountId());
/*      */         }
/* 2344 */         list.add(userMap);
/*      */       }
/*      */     } catch (WavesetException ex) {
/* 2347 */       TRACE.caught1("getUpdatedRows", ex);
/* 2348 */       this._util.logString(1, Util.stackToString(ex));
/*      */     }
/*      */ 
/* 2351 */     TRACE.info2("getUpdatedRows", "updated rows={0}", list);
/* 2352 */     TRACE.exit2("getUpdatedRows");
/* 2353 */     return list;
/*      */   }
/*      */ 
/*      */   protected void traceAndLogCommand(long traceLevel, String method, int logLevel, Map user, String command, WavesetResult result)
/*      */   {
/* 2364 */     if (user == null) {
/* 2365 */       return;
/*      */     }
/*      */ 
/* 2368 */     if ((!TRACE.isLogging(traceLevel, method)) && (this._util.getLogLevel() < logLevel))
/*      */     {
/* 2372 */       return;
/*      */     }
/*      */ 
/* 2375 */     List msgs = result != null ? result.getMessages() : null;
/* 2376 */     List errs = result != null ? result.getErrors() : null;
/*      */ 
/* 2378 */     StringBuffer sb = new StringBuffer();
/* 2379 */     if (result == null) {
/* 2380 */       sb.append("Starting ");
/* 2381 */       sb.append(command);
/* 2382 */       sb.append(" processing for resource ");
/* 2383 */       sb.append(getResource().getName());
/* 2384 */       sb.append('\n');
/* 2385 */       if (TRACE.isLogging(traceLevel, method)) {
/* 2386 */         TRACE.info(traceLevel, method, sb.toString());
/*      */       }
/* 2388 */       if (logLevel < this._util.getLogLevel()) {
/* 2389 */         this._util.logString(logLevel, sb.toString());
/*      */       }
/* 2391 */       sb.setLength(0);
/*      */     }
/*      */ 
/* 2394 */     ActiveSyncUtil.mapToStringBuffer(user, sb);
/* 2395 */     ActiveSyncUtil.listToStringBuffer(errs, sb);
/* 2396 */     ActiveSyncUtil.listToStringBuffer(msgs, sb);
/*      */     try
/*      */     {
/* 2399 */       if (TRACE.isLogging(traceLevel, method)) {
/* 2400 */         TRACE.info(traceLevel, method, sb.toString());
/*      */       }
/* 2402 */       if (logLevel < this._util.getLogLevel())
/* 2403 */         this._util.logString(logLevel, sb.toString());
/*      */     }
/*      */     catch (Throwable th) {
/* 2406 */       System.out.println("ScriptedJDBC Resource adapter. Error writing log: " + th.toString());
/*      */     }
/*      */ 
/* 2409 */     if (result != null) {
/* 2410 */       sb.setLength(0);
/* 2411 */       sb.append("End update processing for resource ");
/* 2412 */       sb.append(getResource().getName());
/* 2413 */       sb.append('\n');
/* 2414 */       if (TRACE.isLogging(traceLevel, method)) {
/* 2415 */         TRACE.info(traceLevel, method, sb.toString());
/*      */       }
/* 2417 */       if (logLevel < this._util.getLogLevel())
/* 2418 */         this._util.logString(logLevel, sb.toString());
/*      */     }
/*      */   }

 public void getActiveSyncIterator()
 {
 	
 }
/*      */ 
/*      */   protected void traceAndLog(long traceLevel, String method, int logLevel, String message)
/*      */   {
/* 2424 */     TRACE.info(traceLevel, method, message);
/* 2425 */     this._util.logString(logLevel, message);
/*      */   }
/*      */ 
/*      */   private class ScriptedJdbcCloseListener implements CloseListener
/*      */   {
/* 2430 */     Connection _con = null;
/*      */ 
/*      */     public ScriptedJdbcCloseListener(Connection con) {
/* 2433 */       this._con = con;
/*      */     }
/*      */ 
/*      */     public void onFinish() {
/* 2437 */       String METHOD = "onFinish";
/*      */ 
/* 2439 */       if (this._con != null) {
/* 2440 */         ScriptedJdbcResourceAdapter.TRACE.info2("onFinish", "Closing connection used by account iteration.");
/*      */ 
/* 2442 */         ScriptedJdbcResourceAdapter.this.closeConnection(this._con);
/* 2443 */         this._con = null;
/*      */       }
/*      */     }
/*      */ 
/*      */     public void onAbort() {
/* 2448 */       String METHOD = "onAbort";
/*      */ 
/* 2450 */       if (this._con != null) {
/* 2451 */         ScriptedJdbcResourceAdapter.TRACE.info2("onAbort", "Destroying connection used by aborted account iteration.");
/*      */ 
/* 2453 */         ScriptedJdbcResourceAdapter.this.destroyConnection(this._con);
/* 2454 */         this._con = null;
/*      */       }
/*      */     }
/*      */   }
/*      */ }

/* Location:           E:\IDM_Code\idmadapter.jar
 * Qualified Name:     com.waveset.adapter.ScriptedJdbcResourceAdapter
 * JD-Core Version:    0.6.0
 */